package com.apollow.oschina.ui;

import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.Toast;

import com.apollow.oschina.R;
import com.apollow.oschina.util.ImageUtils;
import com.apollow.oschina.widget.ImageLoadingDialog;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Dragon on 2017/1/17.
 * 查看大头像
 */
public class LookBigActivity extends AppCompatActivity {
    @BindView(R.id.iv_big_head)
    ImageView mIvBigHead;
    private int mImageId;
    private Uri uri;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_look_big);
        ButterKnife.bind(this);

        Bitmap bitmap = ImageUtils.getBitmap(this, "head.jpg");
        if (bitmap != null) {
            mIvBigHead.setImageBitmap(bitmap);
        } else {
            Toast.makeText(this,"没有图片",Toast.LENGTH_SHORT).show();
        }

        final ImageLoadingDialog dialog = new ImageLoadingDialog(this);
        dialog.show();
        // 两秒后关闭后dialog
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.dismiss();
            }
        }, 1000 * 2);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // TODO Auto-generated method stub
        finish();
        return true;
    }

}
